package com.xiaoyushu.note.biz.domain.mapper;

import com.xiaoyushu.note.biz.domain.dataobject.NoteLikeDO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface NoteLikeDOMapper {
    int deleteByPrimaryKey(Long id);

    int insert(NoteLikeDO record);

    int insertSelective(NoteLikeDO record);

    NoteLikeDO selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(NoteLikeDO record);

    int updateByPrimaryKey(NoteLikeDO record);
/**
 * 添加一个查询当前用户所有点赞的笔记的查询方法，
 */
    List<NoteLikeDO> selectByUserId(@Param("userId")Long userId);

    /**
     * 查寻笔记是否被点赞
     * @param userId
     * @param noteId
     * @return
     */
    int selectNoteIsLiked(@Param("userId") Long userId,@Param("noteId") Long noteId);

    List<NoteLikeDO> selectLikedByUserIdAndLimit(@Param("userId")Long userId,@Param("limit") int limit);


    int insertOrUpdate(NoteLikeDO noteLikeDO);

    /**
     * 取消点赞
     * @param noteLikeDO
     * @return
     */

    int update2UnlikeByUserIdAndNoteId(NoteLikeDO noteLikeDO);
}